package com.djzhou.util;


/**
 * 类型转换
 * @（#）:TypeConvert.java 
 * @author:  DJZHOU  2012-2-27 
 * @version: [SVN] 
 * @modify: 
 * @Copyright:  黑龙江中科方德软件有限公司
 */
public class TypeConvert {
	public static int INTEGER=0;
	public static int STRING=1;
	public static int DOUBLE=2;
	public static int FLOAT=3;
	public static int DATE=4;
	public static int OBJECT=5;
	public static int BOOLEAN=6;
	/**
	 * 类型转换
	 * @param obj
	 * @param type
	 * @return
	 *
	 */
	public static Object convert(Object obj,int type){
		switch (type){
			case 0:
				return Integer.parseInt(obj.toString());
			case 1:
				return obj.toString();
			case 2:
				return Double.parseDouble(obj.toString());
			case 3:
				return Float.parseFloat(obj.toString());
			case 4:
				return obj;
			case 5:
				return obj;
			case 6:
				return (Boolean)obj;
		}
		return null;
	}
	
}
